package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.entity.TbWenjuan;
import com.lrkj.back.mapper.TbWenjuanMapper;
import com.lrkj.back.service.TbWenjuanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("wenjuanService")
public class TbWenjuanServiceImpl extends ParentServiceImpl<TbWenjuan> implements TbWenjuanService {
    @Autowired
    private TbWenjuanMapper wenjuanMapper;

    @Override
    protected DBInterface<TbWenjuan> getDao() throws DBException {
        return wenjuanMapper;
    }

    @Override
    public PageInfo<TbWenjuan> findAllWenjuan(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<TbWenjuan> tbList = wenjuanMapper.findAllWenjuan(map);
        PageInfo<TbWenjuan> page = new PageInfo<>(tbList);
        return page;
    }

}
